<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<% 
	String path = request.getContextPath();
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="path" value="${pageContext.request.contextPath}" ></c:set>
<script type="text/javascript" src="${path }/js/jquery-3.6.0.min.js"></script>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>修改密保密码</title>

    <link rel="icon" type="image/png" href="<%= path %>/assets/images/favicon-32x32.png">

    <link rel="stylesheet" href="<%= path %>/assets/main/css/fonts.css">
    <link rel="stylesheet" href="<%= path %>/assets/main/css/style.css">
</head>

<body>
    <div id="main-wrapper" class="show">

        <!-- start logo components -->
        <div class="nav-header">
            <div class="brand-logo">
                <a href="${path}/web/index.jsp"><h1>首页页面</h1></a>
            </div>
        </div>

      
        
        
        
      
        
        
        <div class="content-body">
            <div class="warper container-fluid">
                <div class="add_Test main_container">
                    <div class="row page-titles mx-0">
                        <div class="col-sm-6 p-md-0">
                            <div class="welcome-text">
                                <h4 class="text-primary">修改密码</h4>
                                <p class="mb-0">Update Password</p>
                            </div>
                        </div>

                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <div class="card shadow mb-4">
                            <div class="card-header">
                                <h4 class="card-title">编辑密码</h4>
                            </div>
                            <div class="card-body">
                                <div class="basic-form">
                                    <form id="usForm" action="${path }/ForgetPasswordController?action=correctUsername" method="post" >
                                        <div class="row">
                                            <div class="col-xl-12">
                                                <div class="form-group">
                                                    <span>新密码</span>
                                                    <input type ="hidden" id="forgetname" name="forgetname" value="${forgetname}"/> 
                                                    <input id="password" name="password" type="text" class="form-control" placeholder="新密码的长度不得少于六位" />
                                                   <span id="passwordMsg"></span>
                                                </div>
                                            </div>
                                            <div class="col-xl-12">
                                                <div class="form-group">
                                                    <span>确认密码</span>
                                                   <input id="confirmPassword" type="text" class="form-control" placeholder="确认密码和新密码保持一致" />
                                                	<span id="confirmPasswordMsg"></span>
                                                </div>
                                            </div>
                                            <div class="col-xl-12">
                                                <div class="form-group">
                                               
                                          <input  type="button" value="保存" id="subBtn" />  
                                                </div>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="footer">
            <div class="copyright">
                <p class="mb-0">Copyright ©&中国航天 &amp;2021
            </div>
        </div>

    </div>

    <script src="<%= path %>/assets/plugins/jquery/jquery.min.js"></script>

    <script src="<%= path %>/assets/plugins/popper/popper.min.js"></script>

    <script src="<%= path %>/assets/plugins/bootstrap/js/bootstrap.min.js"></script>

    <script src="<%= path %>/assets/plugins/moment/moment.min.js"></script>

    <script src="<%= path %>/assets/plugins/daterangepicker/daterangepicker.min.js"></script>

    <script src="<%= path %>/assets/plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="<%= path %>/assets/js/init-tdatatable.js"></script>

    <script src="<%= path %>/assets/plugins/chart/apexcharts-bundle/js/apexcharts.min.js"></script>
    <script src="<%= path %>/assets/js/apex-custom.js"></script>

    <script src="<%= path %>/assets/js/toggleFullScreen.js"></script>
    <script src="<%= path %>/assets/js/main.js"></script>

</body>

</html>

 <%--修改密码验证 --%>
<script type="text/javascript">
   $(function(){
	   //新密码提示验证
	    $("#password").bind("input proprechange",function(){
	    	 var password=$("#password").val();
			   if(password.length<6){
				   $("#passwordMsg").html("新密码的长度不得少于六位");
				   $("#passwordMsg").css("color","blue");
			   }else{
				   $("#passwordMsg").empty();
			   }
	    })
	    //确认密码提示验证
	    $("#confirmPassword").bind("input proprechange",function(){
   			   var password=$("#password").val();
			   var confirmPassword=$("#confirmPassword").val();
			   if(confirmPassword!=password){
				   $("#confirmPasswordMsg").html("确认密码和新密码保持一致");
				   $("#confirmPasswordMsg").css("color","blue");
			   }else{
				   $("#confirmPasswordMsg").empty();
			   }
	    })
	   
	   //修改密码保存按钮的点击事件
	   $("#subBtn").click(function(){
		  
		   //新密码
		   var password=$("#password").val();
		   if(password.length<6){
			   $("#passwordMsg").html("新密码的长度不得少于六位");
			   $("#passwordMsg").css("color","red");
			   $("#password").select();
			   return;
		   }else{
			   $("#passwordMsg").empty();
		   }
		   
		   //确认密码
		   var confirmPassword=$("#confirmPassword").val();
		   if(confirmPassword!=password){
			   $("#confirmPasswordMsg").html("确认密码和新密码保持一致");
			   $("#confirmPasswordMsg").css("color","red");
			   $("#confirmPassword").select();
			   return;
		   }else{
			   $("#confirmPasswordMsg").empty();
		   }
		   alert("密保修改成功");
		   //提交form表单
		   
		   $("#usForm").submit();
		 
		
		   
	   })
	   
	    
   })
</script>








